package com.dragon.modules.yuegou.mapper.wallet;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dragon.modules.yuegou.entity.wallet.MerchantWalletEntity;
import com.dragon.modules.yuegou.model.wallet.MerchantTrade;
import com.dragon.modules.yuegou.model.wallet.MerchantWallet;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

/**
 * 商户钱包 Mapper接口
 *
 * @author pbuilder generated
 * @date 2019-05-07 09:09:32
 * @version 2.0
 */
@Component("waltMerchantWalletMapper")
public interface MerchantWalletMapper extends BaseMapper<MerchantWalletEntity> {

    /**
     * 大运营商户账户查询
     * @param page
     * @param merchantName
     * @return
     */
    IPage<MerchantWallet> search(IPage page,  @Param("busdId")String busdId, @Param("merchantName") String merchantName);

    /**
     * 获得收入支出数据
     * @param busdId 商圈id
     * @param amount true：收入   false ： 支出
     * @return
     */
    List<MerchantTrade> searchAmount(@Param("busdId")String busdId,@Param("query") Boolean amount);

    IPage<MerchantWallet> searchList(IPage page,  @Param("busdId")String busdId, @Param("merchantName") String merchantName);

    /**
     *  钱包减
     * @param id
     * @param withdrawAlipayAmount
     * @param withdrawWechatAmount
     * @return
     */
    int modifyWallet(@Param("id")String id, @Param("alipay")BigDecimal withdrawAlipayAmount, @Param("wechat")BigDecimal withdrawWechatAmount);

    /**
     * 回退钱包
     * @param id
     * @param withdrawAlipayAmount
     * @param withdrawWechatAmount
     * @return
     */
    int modifyWalletBack(@Param("id")String id, @Param("alipay")BigDecimal withdrawAlipayAmount, @Param("wechat")BigDecimal withdrawWechatAmount);
}
